<template>
  <div class="exam-card" @click="onClick">
    <van-icon class="exam-card__icon--prefix" name="orders-o" />
    <div class="cell-main ml5">
      <div class="exam-card__title mb5">{{ examName }}</div>
      <div class="m col-77">{{ data.result }}</div>
    </div>
    <van-icon name="arrow" />
  </div>
</template>

<script>
import { Icon } from "vant";

export default {
  components: {
    [Icon.name]: Icon
  },
  props: {
    data: {
      type: Object,
      required: true
    }
  },
  computed: {
    examName() {
      return `${this.data.createTime.split(" ")[0]}  自测结果`;
    }
  },
  methods: {
    onClick() {
      this.$emit("click");
    }
  }
};
</script>

<style lang="less">
.exam-card {
  background-color: #fff;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: inset 0 -2px 0 0 #f5f5f5;
  height: 150px;
  padding: 0 40px;

  font-size: 36px;
  color: #333333;

  &__title {
    flex: 1;
    font-weight: 500;
  }

  &__icon--prefix ~ &__title {
    margin-left: 10px;
  }

  &__icon--prefix {
    color: @primary;
    font-size: 60px;
  }
}
</style>
